<template>
  <div class="main_box" style="padding:10px">
      <div class="add_wrap">
          <el-form label-width="200px">
              <div class="tit">
                  <h2>基础信息</h2>
                  <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList">返回
                  </el-button>
              </div>
              <el-row>
                  <el-form-item label="标本箱名称:">
                      <span>{{ dataInfo.boxName }}</span>
                  </el-form-item>
                  <el-form-item label="标本箱编号:">
                      <span>{{ dataInfo.boxCode }}</span>
                  </el-form-item>
                  <el-form-item label="标本箱类型:">
                      <span>{{ dataInfo.boxType==1?'一代':'二代' }}</span>
                  </el-form-item>
                  <el-form-item label="MAC地址:">
                      <span>{{ dataInfo.boxMac }}</span>
                  </el-form-item>
                  <el-form-item label="剩余电量:">
                      <span>{{ dataInfo.power }}</span>
                  </el-form-item>
                  <el-form-item label="温度:">
                      <span>{{ dataInfo.temp }}</span>
                  </el-form-item>
                  <el-form-item label="湿度:">
                      <span>{{ dataInfo.damp }}</span>
                  </el-form-item>
                  <el-form-item label="温度最低警报值:">
                      <span>{{ dataInfo.tempMin }}</span>
                  </el-form-item>
                  <el-form-item label="温度最高警报值:">
                      <span>{{ dataInfo.tempMax }}</span>
                  </el-form-item>
                  <el-form-item label="具体位置:">
                      <span>{{ dataInfo.addr }}</span>
                  </el-form-item>
                  <el-form-item label="经度:">
                      <span>{{ dataInfo.lng }}</span>
                  </el-form-item>
                  <el-form-item label="纬度:">
                      <span>{{ dataInfo.lat }}</span>
                  </el-form-item>
                  <el-form-item label='服务员:'>
                    <span>{{ dataInfo.waiterName }}</span>
                  </el-form-item>
                  <el-form-item label="设备状态:">
                      {{ formatBoxStatus(dataInfo.boxStatus) }}
                  </el-form-item>
                  <el-form-item label="创建人:">
                      <span>{{ dataInfo.createUserName }}</span>
                  </el-form-item>
                  <el-form-item label="创建时间:">
                      <span>{{ dataInfo.createDate }}</span>
                  </el-form-item>
                  <el-form-item label="修改人:">
                      <span>{{ dataInfo.modifyUserName }}</span>
                  </el-form-item>
                  <el-form-item label="修改时间:">
                      <span>{{ dataInfo.modifyDate }}</span>
                  </el-form-item>
                  <el-form-item label="备注:">
                      <span>{{ dataInfo.remark }}</span>
                  </el-form-item>
              </el-row>
          </el-form>
      </div>
  </div>
</template>

<script>
import SpecimenApi from '@/api/equip/specimen';
export default {
  data() {
      return {
          dataInfo: {},
      };
  },
  computed: {
  },
  mounted() {
      this.getData()
  },
  methods: {
    async getData() {
      const {data} = await SpecimenApi.getSpecimenInfo({id:this.$route.query.id})
      this.dataInfo = data

    },
    formatBoxStatus(type){
      switch(type){
        case 0:
          return "未连接"
        case 1:
          return "已连接"
        case 2:
          return "已断开"
        case 3:
          return "已休眠"
      }
    },
      returnList() {
          this.$store.dispatch('delView', this.$route);
          this.$router.push({ path: '/equip/specimenManagement' })
      }
  },

}

</script>
<style lang="scss" scoped>
@import "@/assets/css/views/add.scss";
</style>
